# BSD 3-Clause 2023 by Kevin Bloom.

PREFIX ?= /usr/local
INSTALL_PATH ?= $(PREFIX)/bin/
MAN_PATH ?= $(PREFIX)/share/man/man1/
SHARE_PATH ?= $(PREFIX)/share/

CP      = cp
RM      = rm
MKDIR   = mkdir

install:
	-$(CP) aledger $(INSTALL_PATH)
	-$(MKDIR) -p $(SHARE_PATH)aledger
	-$(CP) *.awk $(SHARE_PATH)aledger
	awk -v share_path="$(SHARE_PATH)aledger/" -f replace-share-path.awk aledger > $(INSTALL_PATH)aledger
#	-$(CP) aledger.1 $(MAN_PATH)

uninstall:
	-$(RM) $(INSTALL_PATH)aledger
	-$(RM) -rf $(SHARE_PATH)aledger
#	-$(RM) $(MAN_PATH)aledger.1

